package com.yunbao.project.controller;


import com.yunbao.core.respones.Result;
import com.yunbao.core.shiro.jwt.JwtUtil;
import com.yunbao.project.entity.Merchant;
import com.yunbao.project.service.IMerchantService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;

/**
 * <p>
 * 商家,店主 前端控制器
 * </p>
 *
 * @author 安能
 * @since 2019-09-16
 */
@Slf4j
@RestController
@RequestMapping("merchant")
public class MerchantController {


    @Resource
    IMerchantService merchantService;


    /**
     * <p>登录</p>
     *
     * @param merchant
     * @return
     */
    @PostMapping("login")
    public Result login(@RequestBody Merchant merchant) throws UnsupportedEncodingException {

       log.info("token="+JwtUtil.getId());
        return merchantService.login(merchant);
    }
}
